package com.xinan.utils;

import com.jfinal.core.BaseController;
import com.jfinal.core.Controller;


import com.jfinal.upload.UploadFile;

/**
 * Created with IntelliJ IDEA.
 * User: xiaojing
 * Date: 14-2-22
 * Time: 下午4:21
 * To change this template use File | Settings | File Templates.
 */
public class UploadJsonController  extends BaseController {


        public void uploadFile() {
            try {
            	
                UploadFile upload = getFile("xmjj","F:/temUpload",1024 * 1024 * 20);
                if (upload != null) {
                    setAttr("error",0);
                    setAttr("url","http://www.abc.com/");
                    renderJson();
                }
                else {
                    setAttr("error",1);
                    setAttr("message","请选择文件");
                    renderJson();
                }
            } catch (Exception e) {
                setAttr("error",1);
                setAttr("message","上传出现异常，请重新上传");
                renderJson();
            }

        }

    }
